﻿CREATE TABLE [dbo].[TRABAJADOR](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Dni] [nvarchar](8) NOT NULL,
	[ApePaterno] [nvarchar](50) NOT NULL,
	[ApeMaterno] [nvarchar](50) NOT NULL,
	[Nombres] [nvarchar](50) NOT NULL,
	[FechaNacimiento] [datetime] NOT NULL,
	[Edad] [int] NOT NULL,
	[Direccion] [nvarchar](100) NOT NULL,
	[Email] [nvarchar](50) NOT NULL,
	[IdEstadoCivil] [int] NOT NULL,
	[IdSexo] [int] NOT NULL,
 CONSTRAINT [PK_dbo.TRABAJADOR] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_dbo.TRABAJADOR_dbo.ESTADO_CIVIL_IdEstadoCivil]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[TRABAJADOR]  WITH CHECK ADD  CONSTRAINT [FK_dbo.TRABAJADOR_dbo.ESTADO_CIVIL_IdEstadoCivil] FOREIGN KEY([IdEstadoCivil])
REFERENCES [dbo].[ESTADO_CIVIL] ([ID])
GO

ALTER TABLE [dbo].[TRABAJADOR] CHECK CONSTRAINT [FK_dbo.TRABAJADOR_dbo.ESTADO_CIVIL_IdEstadoCivil]
GO
/****** Object:  ForeignKey [FK_dbo.TRABAJADOR_dbo.SEXO_IdSexo]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[TRABAJADOR]  WITH CHECK ADD  CONSTRAINT [FK_dbo.TRABAJADOR_dbo.SEXO_IdSexo] FOREIGN KEY([IdSexo])
REFERENCES [dbo].[SEXO] ([ID])
GO

ALTER TABLE [dbo].[TRABAJADOR] CHECK CONSTRAINT [FK_dbo.TRABAJADOR_dbo.SEXO_IdSexo]
GO
CREATE NONCLUSTERED INDEX [IX_IdEstadoCivil] ON [dbo].[TRABAJADOR] 
(
	[IdEstadoCivil] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_IdSexo] ON [dbo].[TRABAJADOR] 
(
	[IdSexo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]